package com.zlt.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.zlt.annotation.Column;
import com.zlt.annotation.Id;
import com.zlt.annotation.ManyToOne;
import com.zlt.annotation.Table;

import javax.xml.crypto.Data;

@Table(name = "charge")
public class Charge {

    @Id(name = "charge_id")
    private int cid;// 充值记录主键

    @Column(name = "addtime")
    @JSONField
    private Data addTime;// 充值时间

    @Column
    @JSONField
    private double amount;// 充值金额

    @ManyToOne(name = "user_id")
    @JSONField
    private User user;// 用户id，外键

    public Charge() {
    }

    public Charge(int cid, Data addTime, double amount, User user) {
        this.cid = cid;
        this.addTime = addTime;
        this.amount = amount;
        this.user = user;
    }

    public int getCid() {
        return cid;
    }

    public void setCid(int cid) {
        this.cid = cid;
    }

    public Data getAddTime() {
        return addTime;
    }

    public void setAddTime(Data addTime) {
        this.addTime = addTime;
    }

    public double getAmount() {
        return amount;
    }

    public void setAmount(double amount) {
        this.amount = amount;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @Override
    public String toString() {
        return "Charge{" +
                "cid=" + cid +
                ", addTime=" + addTime +
                ", amount=" + amount +
                ", user=" + user +
                '}';
    }
}
